﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YF_Music.Core.Enums;
using YF_Music.Core.Models;

namespace YF_Music.Core.Services
{
  public interface IMusicPlayerService
  {
    PlayMode PlayMode { get; set; }
    /// <summary>
    /// 获取当前播放状态
    /// </summary>
    PlayState PlayState { get; }
    /// <summary>
    /// 获取当前播放时间 1秒一刷新
    /// </summary>
    TimeSpan CurrentPosition { get;  }
    /// <summary>
    /// 获取当前播放时间（实时）
    /// </summary>
    TimeSpan CurrentPositionRealTime { get; }
    /// <summary>
    /// 获取或设置 当前播放时间（秒）
    /// </summary>
    double CurrentSeconds { get; set; }

    bool IsListEqual(ObservableCollection<MusicItem> playlist);

    TimeSpan TotalDuration { get; }
    MusicItem CurrentMusic { get; }
    /// <summary>
    /// 加载音乐播放列表
    /// </summary>
    /// <param name="playlist"></param>
    void LoadPlaylist(ObservableCollection<MusicItem> playlist, PlaylistSession session);
    /// <summary>
    /// 播放指定索引的音乐 -1表示继续播放当前音乐
    /// </summary>
    /// <param name="index"></param>
    void Play(int index = -1);
    void Pause();
    void Stop();
    void PlayNext();
    void PlayPrevious();

    /// <summary>
    /// 向后跳转
    /// </summary>
    /// <param name="interval"></param>
    void SeekForward(TimeSpan interval);
    void SeekBackward(TimeSpan interval);

    /// <summary>
    /// 获取或设置音量（0-100）
    /// </summary>
    double Volume { get; set; }
    /// <summary>
    /// 获取或设置静音状态
    /// </summary>
    bool IsMuted { get; set; }
    /// <summary>
    /// 切换静音状态
    /// </summary>
    void ToggleMute();

    void SetSessionDirty();
    bool LoadLyric(string lrcPath);
    event Action<string> LyricChanged;

    event Action<MusicItem> CurrentMusicChange;
  }
}
